* xterm.c (x_new_font): Reject fonts with varying spacing. We
authorJim Blandy <jimb@redhat.com>
Mon, 24 May 1993 15:04:07 +0000 (15:04 +0000)
committerJim Blandy <jimb@redhat.com>
Mon, 24 May 1993 15:04:07 +0000 (15:04 +0000)
don't support them yet.
* xfns.c (x_set_font): Report the error message properly.

src/xterm.c

index 8ea6bdd3fbe00eae9a5d1c6ea0debb8d43671630..9d85e1c9d2810e125ef8f4871d7eb6b0400fb8f1 100644 (file)
@@ -3877,6 +3877,7 @@ x_new_font (f, fontname)
   font_names = (char **) XListFontsWithInfo (x_current_display, fontname,
                                             1024, &n_matching_fonts,
                                             &font_info);
+
   /* If the server couldn't find any fonts whose named matched fontname,
      return an error code.  */
   if (n_matching_fonts == 0)
@@ -3904,8 +3905,19 @@ x_new_font (f, fontname)
   /* Otherwise, load the font and add it to the table.  */
   else
     {
+      int i;
       XFontStruct *font;
 
+      /* Try to find a character-cell font in the list.  */
+      for (i = 0; i < n_matching_fonts; i++)
+       if (! font_info[i].per_char)
+         break;
+
+      if (i >= n_matching_fonts)
+       return 2;
+      else
+       fontname = font_names[i];
+
       font = (XFontStruct *) XLoadQueryFont (x_current_display, fontname);
       if (! font)
        return 1;